//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class CStringMapper {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CStringMapper(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CStringMapper obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CStringMapper(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static SWIGTYPE_p_std__string map(String str) {
    long cPtr = nelmiscJNI.CStringMapper_map(str);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__string(cPtr, false);
  }

  public static String unmap(SWIGTYPE_p_std__string stringId) {
    return nelmiscJNI.CStringMapper_unmap(SWIGTYPE_p_std__string.getCPtr(stringId));
  }

  public static void serialString(IStream f, SWIGTYPE_p_p_std__string id) {
    nelmiscJNI.CStringMapper_serialString(IStream.getCPtr(f), f, SWIGTYPE_p_p_std__string.getCPtr(id));
  }

  public static SWIGTYPE_p_std__string emptyId() {
    long cPtr = nelmiscJNI.CStringMapper_emptyId();
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__string(cPtr, false);
  }

  public static void clear() {
    nelmiscJNI.CStringMapper_clear();
  }

  public static CStringMapper createLocalMapper() {
    long cPtr = nelmiscJNI.CStringMapper_createLocalMapper();
    return (cPtr == 0) ? null : new CStringMapper(cPtr, false);
  }

  public SWIGTYPE_p_std__string localMap(String str) {
    long cPtr = nelmiscJNI.CStringMapper_localMap(swigCPtr, this, str);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__string(cPtr, false);
  }

  public String localUnmap(SWIGTYPE_p_std__string stringId) {
    return nelmiscJNI.CStringMapper_localUnmap(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(stringId));
  }

  public void localSerialString(IStream f, SWIGTYPE_p_p_std__string id) {
    nelmiscJNI.CStringMapper_localSerialString(swigCPtr, this, IStream.getCPtr(f), f, SWIGTYPE_p_p_std__string.getCPtr(id));
  }

  public void localClear() {
    nelmiscJNI.CStringMapper_localClear(swigCPtr, this);
  }

}
